﻿using System;
using SmartCard.Framework;

namespace SmartCard.GSM_11_11
{
	/// <summary>
	/// Feature provides the unique identification number for the
	/// SIM card following GSM 11.11 Version 5.0.0 December 1995
	/// Specification
	/// </summary>
	public class Gsm_11_11_Features : ICardFeature
	{
		#region fields

		private readonly byte[] _MasterFile = new byte[] { 0x3F, 0x00 };
		private readonly byte[] _IccFileId = new byte[] { 0x2F, 0xE2 };

		private ICard _card = null;

		#endregion

		#region construction

		public Gsm_11_11_Features(ICard card)
		{
			if (card == null)
			{ throw new ArgumentNullException("card"); }

			_card = card;
		}

		#endregion

		public bool IsSupported()
		{
			return true;
		}

		public IccIdentification GetIcc()
		{
			var opp = new SelectFileOperation(_card, _MasterFile);
			var result = opp.Execute();

			opp = new SelectFileOperation(_card, _IccFileId);
			result = opp.Execute();

			return null;
		}

		public ICard Card
		{ get; set; }
	}
}
